<?php

#<editor-fold defaultstate="collapsed" desc="CCore::Using">
CCore::Using('base.collection');
#</editor-fold>

class CCoreBaseDevelopments extends ACoreBaseCollection
{
	const INFO = 1;
	const ERROR = 2;
	const WARNING = 4;
	const NOTICE = 8;

	/**
	 * @var	array
	 */
	private $_aPrefixs;

	/**
	 * @return	CCoreBaseDevelopments
	 */
	public function __construct($sInfoPrefix, $sErrorPrefix, $sWarningPrefix, $sNoticePrefix)
	{
		CCore::CheckTypes(array('$sInfoPrefix', '$sErrorPrefix', '$sWarningPrefix', '$sNoticePrefix'));

		$this->_aPrefixs = array(
			self::INFO => $sInfoPrefix,
			self::ERROR => $sErrorPrefix,
			self::WARNING => $sWarningPrefix,
			self::NOTICE => $sNoticePrefix
		);
		
		parent::__construct();
	}

	public function Add(ICoreBaseDevelopmentsIncInterface $oEventFollower)
	{
		CCore::CheckTypes(array('$oEventFollower'));

		parent::Add($oEventFollower);
	}

	public function Write($sDesc, $iDescType = self::INFO)
	{
		CCore::CheckTypes(array('$sDesc', '$iDescType'));

		$nsPrefix = isset($this->_aPrefixs[$iDescType]) ? $this->_aPrefixs[$iDescType] : null;
		$aFollowers =& $this->GetArray();
		foreach ($aFollowers as $oFollower)
		{
			$oFollower->Write($sDesc, $iDescType, $nsPrefix);
		}
	}
}